# coding=utf8
from werobot import WeRoBot
robot = WeRoBot(token='robotLock',APP_ID='wxc9433e4ffbb31474',APP_SECRET='d7de31e3244c8fd6fa1df5f59e62d20a')
client = robot.client

client.create_menu({
    "button":[
    {
        "name":u"公司",
        "sub_button":[
            {
                "type":"click",
                "name":u"公司简介",
                "key":"company_info"
            },
            {
                "type":"click",
                "name":u"经典案例",
                "key":"simple_case"
            }
        ]
    },
    {
        "name":u"产品",
        "sub_button":[
            {
                "type":"click",
                "name":u"新品上市",
                "key":"new_product"
            },
            {
                "type":"click",
                "name":u"淘宝新品",
                "key":"taobao_new_prouct"
            }
        ]
    },
    {
        "name":u"服务",
        "sub_button":[
            {
                "type":"click",
                "name":u"APP下载",
                "key":"app_download"
            },
            {
                "type":"click",
                "name":u"联系我们",
                "key":"contact_us"
            },
            {
                "type":"click",
                "name":u"服务支持",
                "key":"service_support"
            }
        ]
    }
]})

@robot.key_click("company_info")
def company_info(message):
    return u'公司简介'

@robot.key_click("simple_case")
def simple_case(message):
    return u'经典案例'

@robot.key_click("new_product")
def new_product(message):
    return u'新品上市'

@robot.key_click("taobao_new_prouct")
def taobao_new_prouct(message):
    return u'淘宝新品'

@robot.key_click("app_download")
def app_download(message):
    return u'APP下载'

@robot.key_click("contact_us")
def contact_us(message):
    return u'联系我们'

@robot.key_click("service_support")
def service_support(message):
    return u'服务支持'

#@robot.handler
#def hello(message):
#    return 'Hello world'

@robot.text
def echo(message):
    return message.content

@robot.image
def img(message):
    return message.img

